package com.gec.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.system.SysLoginLog;
import com.gec.model.system.SysOperLog;
import com.gec.model.vo.SysLoginLogQueryVo;
import com.gec.model.vo.SysOperLogQueryVo;
import com.gec.system.common.Result;

import com.gec.system.service.SysOperLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author:啊薰
 * @create:2024-05-29 23:00
 */
@Api("操作日志控制器")
@RestController
@RequestMapping("/admin/system/sysOperLog")
public class SysOperLogController {
    @Autowired
    private SysOperLogService sysOperLogService;

    @ApiOperation(value = "获取分页列表")
    @GetMapping("/{page}/{limit}")
    public Result QueryLoginLog(
            @PathVariable Long page,
            @PathVariable Long limit,
            SysOperLogQueryVo sysOperLogQueryVo) {

        IPage<SysOperLog> iPage = sysOperLogService.selectPage(page, limit, sysOperLogQueryVo);
        return Result.ok(iPage);
    }

    // 批量删除
    @DeleteMapping("/bactchRemoveOrOneIds")
    public Result bactchRemoveOrOneIds(@RequestBody List<Long> ids)
    {
        boolean b = this.sysOperLogService.removeByIds(ids);
        if (b)
        {
            return Result.ok();
        }
        else
        {
            return Result.fail();
        }
    }
}
